package com.pshcp.patient.tool;

import com.framework.thread.ReqComHold;
import com.pshcp.common.enums.CommonStatusEnum;
import com.pshcp.common.tool.PhotoTools;
import com.pshcp.domain.dto.PatientFavorDTO;
import com.pshcp.domain.model.Doctor;
import com.pshcp.domain.model.PatientFavor;
import com.pshcp.patient.domain.patientfavor.ao.PatientFavorListAO;
import com.pshcp.patient.domain.patientfavor.vo.PatientFavorVO;

public class PatientFavorTools {

    public static PatientFavor buildModel(Long doctorId){
        PatientFavor favor = new PatientFavor();
        favor.setDoctorId(doctorId);
        favor.setPatientUserId(ReqComHold.getReqCom().getUserId());
        return favor;
    }

    public static PatientFavorDTO buildFavorListAO2DTO(PatientFavorListAO listAO){
        PatientFavorDTO favor = new PatientFavorDTO();
        favor.setStatus(CommonStatusEnum.INIT.getCode());
        favor.setPatientUserId(ReqComHold.getReqCom().getUserId());
        favor.setPageNum(listAO.getPageNum());
        favor.setPageSize(listAO.getPageSize());
        return favor;
    }

    public static void buildDoctor2FavorVO(PatientFavorVO favorVO, Doctor doctor, String imgPrefix){
        if(doctor == null){
            return;
        }
        favorVO.setDeptName(doctor.getMainDeptName());
        favorVO.setDoctorId(doctor.getId());
        favorVO.setHisDoctorId(doctor.getHisDoctorId());
        favorVO.setName(doctor.getName());
        favorVO.setSex(doctor.getSex());
        favorVO.setQr(doctor.getQr());
        favorVO.setGoodAt(doctor.getGoodAt());
        favorVO.setReusme(doctor.getReusme());
        favorVO.setDescription(doctor.getDescription());
        favorVO.setAddress(doctor.getAddress());
        favorVO.setMediLevel(doctor.getMediLevel());
        favorVO.setRemark(doctor.getRemark());
        favorVO.setBodyPhoto(doctor.getBodyPhoto());
        favorVO.setHeadPhoto(doctor.getHeadPhoto());
        favorVO.setFullHeadPhotoPath(PhotoTools.getFullPath(imgPrefix, favorVO.getHeadPhoto()));
        favorVO.setTitleShown(doctor.getTitleShown());
        favorVO.setExpectFlag(doctor.getExpectFlag());
    }

}
